package com.zqh.myfmmall.fallback;

import com.zqh.myfmmall.clients.ShoppingCartCUDClient;
import com.zqh.myfmmall.result.Result;
import com.zqh.myfmmall.rowbeans.entity.ShoppingCart;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @Description :
 * @Author :kono淇杭哒、
 * @Create 2022-03-16 22:53
 */
@Slf4j
public class ShoppingCartCUDClientFallback implements FallbackFactory<ShoppingCartCUDClient>{
    @Override
    public ShoppingCartCUDClient create(Throwable cause) {
      log.warn("exception in calling shoppingcartcud service"+cause);
      return new ShoppingCartCUDClient(){
          @Override
          public Result add(ShoppingCart shoppingCart) {
              return Result.internalServerError();
          }

          @Override
          public Result update(ShoppingCart shoppingCart) {
              return Result.internalServerError();
          }

          @Override
          public Result updateBatch(List<ShoppingCart> shoppingCarts) {
              return Result.internalServerError();
          }

          @Override
          public Result delete(List<String> ids) {
              return Result.internalServerError();
          };
      };
    }
}
